/* AI教练悬浮球样式 */
.ai-coach-ball {
  position: fixed;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  cursor: move;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.ai-coach-ball:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.ai-coach-ball.dragging {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.8);
  cursor: grabbing;
}

.ai-coach-avatar {
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* 脉冲动画 */
.ai-coach-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  animation: pulse 2s infinite;
  opacity: 0.7;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.3;
  }
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
}

/* 对话框样式 */
.ai-coach-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px 16px 0 0;
  color: white;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.ai-coach-dialog-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-coach-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

.ai-coach-dialog-title svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.ai-coach-dialog-content {
  max-height: 450px;
  display: flex;
  flex-direction: column;
  background: #fafbfc;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

.ai-coach-messages {
  max-height: 320px;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(180deg, #fafbfc 0%, #f8f9fa 100%);
  flex: 1;
}

.ai-coach-message {
  margin-bottom: 16px;
  display: flex;
  animation: messageSlideIn 0.3s ease-out;
}

.ai-coach-message.user-message {
  justify-content: flex-end;
}

.ai-coach-message.ai-message {
  justify-content: flex-start;
}

.message-content {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-text {
  flex: 1;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  align-self: flex-end;
  margin-top: 2px;
}

.message-content:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-message .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.user-message .message-content::before {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 6px;
  width: 0;
  height: 0;
  border-left: 8px solid #764ba2;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.ai-message .message-content {
  background: white;
  color: #2c3e50;
  border-bottom-left-radius: 6px;
  border: 1px solid #e8ecf0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-message .message-content::before {
  content: '';
  position: absolute;
  left: -8px;
  bottom: 6px;
  width: 0;
  height: 0;
  border-right: 8px solid white;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 打字动画 */
.message-content.typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
}

.message-content.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  animation: typing 1.6s infinite;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.message-content.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.message-content.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-8px) scale(1.2);
    opacity: 1;
  }
}

.ai-coach-input {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  padding: 20px;
  background: white;
  border-top: 1px solid #e8ecf0;
  border-radius: 0 0 16px 16px;
}

.ai-coach-input .adm-text-area {
  flex: 1;
  border-radius: 20px;
  border: 2px solid #e8ecf0;
  transition: all 0.3s ease;
  background: #fafbfc;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 16px;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.ai-coach-input .adm-text-area:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
  outline: none;
}

.ai-coach-input .adm-text-area::placeholder {
  color: #999;
  font-size: 14px;
  line-height: 1.4;
}

.ai-coach-input .adm-button {
  border-radius: 20px;
  height: 40px;
  padding: 0 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.ai-coach-input .adm-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.ai-coach-input .adm-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ai-coach-input .adm-button:disabled {
  background: #e8ecf0;
  color: #999;
  box-shadow: none;
  transform: none;
}

/* 滚动条样式 */
.ai-coach-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-coach-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.ai-coach-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.ai-coach-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  width: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .ai-coach-ball {
    width: 50px;
    height: 50px;
  }
  
  .ai-coach-ball .ai-coach-avatar {
    font-size: 18px;
  }
  
  .ai-coach-dialog-content {
    max-height: 400px;
  }
  
  .ai-coach-messages {
    max-height: 280px;
    padding: 16px;
  }
  
  .message-content {
    max-width: 90%;
    font-size: 14px;
    padding: 10px 14px;
  }
  
  .ai-coach-input {
    padding: 16px;
    gap: 10px;
  }
  
  .ai-coach-input .adm-text-area {
    font-size: 13px;
    padding: 8px 14px;
    min-height: 36px;
  }
  
  .ai-coach-input .adm-text-area::placeholder {
    font-size: 13px;
  }
  
  .ai-coach-input .adm-button {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
  }
  
  .ai-coach-dialog-header {
    padding: 12px 16px;
  }
  
  .ai-coach-dialog-title {
    font-size: 15px;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .ai-coach-messages {
    max-height: 250px;
    padding: 12px;
  }
  
  .message-content {
    max-width: 95%;
    font-size: 13px;
    padding: 8px 12px;
  }
  
  .ai-coach-input {
    padding: 12px;
    flex-direction: column;
    gap: 8px;
  }
  
  .ai-coach-input .adm-text-area {
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
  }
  
  .ai-coach-input .adm-text-area::placeholder {
    font-size: 12px;
  }
  
  .ai-coach-input .adm-button {
    width: 100%;
    height: 40px;
    font-size: 13px;
  }
}
